package logic.util;

import java.util.concurrent.ConcurrentHashMap;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

public class EasyLog {
	private static ConcurrentHashMap<Class,Logger> loggerMap=new ConcurrentHashMap<>();
	
	public static void info(Class clazz,String msg,Object...args){
		getLogger(clazz).info(msg,args);
		System.out.println(msg);
	}
	public static void error(Class clazz,Throwable t){
		getLogger(clazz).catching(t);
		System.out.println(t);
	}
	
	
	private static Logger getLogger(Class clazz){
		if(null==loggerMap.get(clazz)){
			loggerMap.putIfAbsent(clazz, LogManager.getLogger(clazz));
		}
		return loggerMap.get(clazz);
	}
	
}
